home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Mac Game Programming Gurus / TricksOfTheMacGameProgrammingGurus.iso / More Source / C⁄C++ / Xconq 7.0d37 / lib / classic.g < prev    next >
Text File  |  1995-05-04  |  15KB  |  553 lines

  1. (game-module "classic"
  2.   (title "Classic Xconq")
  3.   (blurb "The classic Xconq game, loosely based on WW II ca 1945.  For old Xconq hands only.")
  4.   (variants
  5.     (world-seen false)
  6.     (world-size (60 30 60))
  7.     ("Own Initial Towns" own-initial-towns
  8.        (true
  9.       (add * start-with 5)
  10.      (add * independent-near-start 0)
  11.      ))
  12.     )
  13. )
  14.  
  15. (unit-type infantry (image-name "soldiers"))
  16. (unit-type armor (image-name "tank"))
  17. (unit-type fighter (image-name "fighter"))
  18. (unit-type bomber (image-name "4e"))
  19. (unit-type destroyer (image-name "dd"))
  20. (unit-type submarine (image-name "sub"))
  21. (unit-type troop-transport (name "troop transport") (image-name "ap"))
  22. (unit-type carrier (image-name "cv") (char "C"))
  23. (unit-type battleship (image-name "bb") (char "B"))
  24. (unit-type nuclear-bomb (name "nuclear bomb") (image-name "bomb") (char "N"))
  25. (unit-type base (image-name "airbase") (char "/"))
  26. (unit-type town (image-name "town20") (char "*"))
  27. (unit-type city (image-name "city20") (char "@"))
  28.  
  29. (define i infantry)
  30. (define a armor)
  31. (define f fighter)
  32. (define b bomber)
  33. (define d destroyer)
  34. (define s submarine)
  35. (define t troop-transport)
  36. (define cv carrier)
  37. (define bb battleship)
  38. (define nk nuclear-bomb)
  39. (define / base)
  40. (define * town)
  41. (define @ city)
  42.  
  43. (material-type fuel)
  44. (material-type ammo)
  45.  
  46. (terrain-type sea (color "sky blue") (char "."))
  47. (terrain-type shallows (color "cyan") (char ","))
  48. (terrain-type swamp (color "yellow green") (char "="))
  49. (terrain-type desert (color "yellow") (char "~"))
  50. (terrain-type plains (color "green") (char "+"))
  51. (terrain-type forest (color "forest green") (char "%"))
  52. (terrain-type mountains (color "sienna") (char "^"))
  53. (terrain-type ice (color "white") (char "_"))
  54. (terrain-type vacuum (color "black") (char ":"))
  55.  
  56. (define makers (* @))
  57. (define ground (i a))
  58. (define aircraft (f b))
  59. (define ship (d s t cv bb))
  60. (define cities (/ * @))
  61. (define movers (i a f b d s t cv bb nk))
  62.  
  63. (define water (sea shallows))
  64. (define land (plains forest desert mountains))
  65.  
  66. (set edge-terrain ice)
  67.  
  68. ;;; Setup.
  69.  
  70. (set alt-blob-density 5000)
  71. (set alt-blob-size 40)
  72. (set wet-blob-density 1000)
  73. (set wet-blob-size 100)
  74.  
  75. (add t* alt-percentile-min (  0  68  69  70  70  70  93  99  0))
  76. (add t* alt-percentile-max ( 68  69  71  93  93  93  99 100  0))
  77. (add t* wet-percentile-min (  0   0  50   0  20  80   0   0  0))
  78. (add t* wet-percentile-max (100 100 100  20  80 100 100 100  0))
  79.  
  80. (add @ start-with 1)
  81. (add * independent-near-start 5)
  82. (set country-radius-min 2)
  83. (set country-separation-min 16)
  84. (set country-separation-max 48)
  85. ;; Try to get countries on the coast.
  86. (add (sea plains) country-terrain-min (3 6))
  87.  
  88. (table favored-terrain
  89.   (u* t* 0)
  90.   (@ plains 100)
  91.   (* land 20)
  92.   (* plains 40)
  93.   )
  94.  
  95. (table independent-density
  96.   (town (plains desert mountains forest) (100 50 50 50))
  97.   )
  98.  
  99. (table unit-initial-supply
  100.   (u* fuel ( 6 10 18 36 100 100 200 400 200 1 200 500 900))
  101.   (u* ammo ( 6  4  3  3  20  10  20  40  40 1 100 200 400))
  102.   )
  103.  
  104. ;;; Unit-unit relationships.
  105.  
  106. (table unit-capacity-x
  107.   (cv fighter 4)  ; this part of a carrier's capacity can't be used by bombers
  108.   )
  109.  
  110. (table unit-size-as-occupant
  111.   (u* u* 100) ; disables occupancy by default
  112.   ((i nk) b 1)
  113.   (ground t 1)
  114.   ((f b) cv (1 2))
  115.   (u* / 2)
  116.   (fighter / 1)
  117.   (movers (* @) 1)
  118.   ;; higher sizes for ships? used to be 6 for bbs, etc
  119.   )
  120.  
  121. (add u* capacity (0 0 0 1 0 0 6 4 0 0 20 40 80))
  122.  
  123. (table occupant-max
  124.   (u* u* 100)
  125.   )
  126.  
  127. ;;; Unit-terrain relationships.
  128.  
  129. (table vanishes-on
  130.   (ground water true)
  131.   (cities water true)
  132.   (ship land true)
  133.   (u* ice true)
  134.   (aircraft ice false)
  135.   )
  136.  
  137. ;; Always only one unit per cell.
  138.  
  139. (table unit-size-in-terrain
  140.   (u* t* 1)
  141.   )
  142.  
  143. (add t* capacity 1)
  144.  
  145. ;;; Unit-material relationships.
  146.  
  147. (table unit-storage-x
  148.   (u* fuel ( 6 10 18 36 100 100 200 400 200 1 200 500 900))
  149.   (u* ammo ( 6  4  3  3  20  10  20  40  40 1 100 200 400))
  150.   )
  151.  
  152. (table base-production
  153.   (ground fuel 1)
  154.   (cities fuel (10 20 50))
  155.   (cities ammo (5 10 20))
  156.   )
  157.  
  158. (table productivity
  159.   (i (desert mountains) 0)
  160.   (a (desert forest mountains) 0)
  161.   (/ land (100 50 20 20))
  162.   (* land (100 50 20 20))
  163.   (@ land (100 50 20 20))
  164.   )
  165.  
  166. ; fighter fuel consumption is problem for carriers, should probably
  167. ; make carrier prod high or else bump up capacity
  168. ; (on the other hand, high consumption *is* more realistic...)
  169.  
  170. (table base-consumption
  171.   ((i f b) fuel (1 3 2))
  172.   (ship fuel 1)
  173. )
  174.  
  175. (table hp-per-starve
  176.   ((i f b) fuel 1.00)
  177.   (ship fuel 10.00)
  178.   )
  179.  
  180. ; 0 [ f b ] consume-as-occupant
  181.  
  182. ;;; Actions.
  183.  
  184. (add u* acp-per-turn  (1 2 9 6 3 3 2 4 4 1 0 1 1))
  185.  
  186. ;;; Movement.
  187.  
  188. (add (/ * @) speed 0)
  189.  
  190. (table mp-to-enter-terrain
  191.   ((cv bb) shallows 2)
  192.   ;; Accident prevention.
  193.   ((i a) (sea shallows) 99)
  194.   (ship land 99)
  195.   (a (swamp forest mountains) 99)
  196. )
  197.  
  198. ;;; Everybody needs and uses fuel to move, except for nukes.
  199.  
  200. (table material-to-move
  201.   (movers fuel 1)
  202.   (nk fuel 0)
  203. )
  204.  
  205. (table consumption-per-move
  206.   (movers fuel 1)
  207.   (nk fuel 0)
  208. )
  209.  
  210. (table mp-to-enter-unit
  211.   (u* u* 1)
  212.   ;; Aircraft can't sortie again until next turn.
  213.   (f u* 9)
  214.   (b u* 6)
  215.   (ship u* 0)
  216.   (nk u* 0)
  217.   ;; Armor can travel quickly on the many roads found around cities.
  218.   (a (* @) 0)
  219. )
  220.  
  221. ;;; Construction.
  222.  
  223. (add nk tech-max 60)
  224. (add nk tech-to-build 60)
  225.  
  226. (table acp-to-research
  227.   ;; only cities can research nukes
  228.   (@ nk 1)
  229.   )
  230.  
  231. (table tech-per-research
  232.   ;; only cities can research nukes
  233.   (@ nk 1.00)
  234.   )
  235.  
  236. (table acp-to-toolup
  237.   ((* @) u* 1)
  238.   )
  239.  
  240. (table tp-to-build
  241.   (* movers (1 2 2 3 2 3 2 6 8 4))
  242.   (@ movers (1 2 2 3 2 3 2 6 8 4))
  243.   )
  244.  
  245. (table tp-max
  246.   (* movers (1 2 2 3 2 3 2 6 8 4))
  247.   (@ movers (1 2 2 3 2 3 2 6 8 4))
  248.   )
  249.  
  250. (add u* cp (4 7 8 16 10 16 12 30 40 20 3 1 1))
  251.  
  252. (table acp-to-create
  253.   (ground / 1)
  254.   ((* @) movers 1)
  255.   )
  256.  
  257. (table cp-on-creation
  258.   (ground / 1)
  259.   ((* @) movers 1)
  260.   )
  261.  
  262. (table acp-to-build
  263.   (ground / 1)
  264.   ((* @) movers 1)
  265.   )
  266.  
  267. (table cp-per-build
  268.   (ground / 1)
  269.   ((* @) movers 1)
  270.   )
  271.  
  272. ; which way does old Xconq really work?
  273. ;(table supply-on-creation
  274. ;  (u* fuel ( 6 10 18 36 100 100 200 400 200 1 200 500 900))
  275. ;  (u* ammo ( 6  4  3  3  20  10  20  40  40 1 100 200 400))
  276. ;)
  277.  
  278. (table hp-per-repair
  279.   ((* @) u* 1)
  280.   (/ u* 3)
  281.   ((cv bb) (cv bb) 10)
  282.   (i cities (1 10 10))
  283. )
  284.  
  285. ;;; Vision.
  286.  
  287. ; 10 s visibility
  288. ; 10 N visibility
  289.  
  290. (add (* @) see-always true)
  291.  
  292. (add @ vision-range 3)
  293.  
  294. ;;; Combat.
  295.  
  296. (add u* hp-max (1 1 1 2 3 2 3 4 8 1 10 20 40))
  297.  
  298. ;; Units are generally crippled at about 50% of hp-max.
  299.  
  300. ;(add movers hp-at-max-speed (1 1 1 2 2 2 2 2 4 1))
  301. ;(add movers hp-at-min-speed (0 0 0 1 1 1 2 2 1 0))
  302. (add movers speed-min    (0 0 0 3 3 3 2 1 2 1))
  303.  
  304. ;;; The main hit chance table.
  305.  
  306. (table hit-chance
  307.   (i  u* ( 50  40  20  15  20  20  30  20   9  40  80  60  40))
  308.   (a  u* ( 60  50  30  30  30  20  30  20  20  50  90  70  50))
  309.   (f  u* ( 15  25  60  70  20  30  20  50  40  80 100 100 100))
  310.   (b  u* ( 20  20  10   9  30  50  50  70  60  50  90  95  99))
  311.   (d  u* (  5   5  10   5  60  70  60  40  20   0  99  90  80))
  312.   (s  u* (  0   0  10   5  40  10  60  40  50   0   0   0   0))
  313.   (t  u* ( 20   5  10   5  40  40  40  30   9   0   0   0   0))
  314.   (cv u* ( 30  20  40  10  30  30  40  20  20   0   0   0   0))
  315.   (bb u* ( 50  50  50  20  70  50  90  50  90   0 100 100 100))
  316.   (nk u* ( 99  99  99  99  99  99  99  99  99   0  99  99  99))
  317.   (/  u* ( 10  10  20  20  20  20  30  20  20   0   0   0   0))
  318.   (*  u* ( 30  20  50  40  40   0  30  20  20   0   0   0   0))
  319.   (@  u* ( 50  40  70  60  50   0  30  20  50   0   0   0   0))
  320.   )
  321.  
  322. ;;; The main damage table.
  323.  
  324. (table damage
  325.   (u* u* 1)
  326.   (a cities 2)
  327.   (b ship 2)
  328.   (b s 1)
  329.   (b cities (2 2 3))
  330.   (d s 2)
  331.   (s ship 3)
  332.   (s bb 4)
  333.   (bb u* 2)
  334.   (bb (* @) 3 4)
  335.   (nk u* 60)   ; wham!
  336.   )
  337.  
  338. (table capture-chance
  339.   (i cities (70 50 30))
  340.   (a cities (90 70 50))
  341.   )
  342.  
  343. (table independent-capture-chance
  344.   (i cities (100 80 50))
  345.   (a cities (100 95 70))
  346.   )
  347.  
  348. ;; Attack and counterattack are completely symmetrical.
  349.  
  350. ;(table counter-strength (u* u* 100))
  351.  
  352. ;; infantry can capture cities even on water.
  353.  
  354. (table bridge
  355.   (i cities true)
  356.   )
  357.  
  358. (table protection ; actually ablation?
  359.   ; cities offer some protection to occupants
  360.   (cities movers 50)
  361.   ; inf and armor protect the cities housing them.
  362.               ; can't make this too large or city can be
  363.               ; invulnerable.
  364.   (i cities 5)
  365.   (a cities 10)
  366.   ; bases benefit more from protection.
  367.   ((i a) / (15 25))
  368.   )
  369.  
  370. ;; We need ammo to hit with, but no details about types etc.
  371.  
  372. ;(table hits-with (u* ammo 1))
  373.  
  374. (table hit-by
  375.   (u* ammo 1)
  376.   )
  377.  
  378. ;(add ground destroy-message "defeats")
  379. ;(add ship destroy-message "sinks")
  380. ;(add aircraft destroy-message "shoots down")
  381. ;(add cities destroy-message "flattens")
  382.  
  383. ;;; Other Actions.
  384.  
  385. (add movers acp-to-disband 1)
  386.  
  387. ;; This does everybody in one shot.
  388.  
  389. (add movers hp-per-disband 10)
  390.  
  391. ;; Takes a while to dismantle a base.
  392.  
  393. (add / hp-per-disband 2)
  394.  
  395. ;; Only infantry cannot change hands.
  396.  
  397. (add u* acp-to-change-side 1)
  398. (add i acp-to-change-side 0)
  399.  
  400. (add i possible-sides (not "independent"))
  401.  
  402. ;; Special characteristics for nuclear bombs.
  403.  
  404. ;(add N can-counter false)
  405. ;(add nk self-destructs true)
  406.  
  407. ;;; Economy.
  408.  
  409. (table out-length
  410.   ;; These types should never give up any of their supplies.
  411.   ((i a f b nk) m* -1)
  412.   )
  413.  
  414. ;;; Scoring.
  415.  
  416. (add (* @) point-value (1 5))
  417.  
  418. (scorekeeper (do last-side-wins))
  419.  
  420. ;;; Documentation.
  421.  
  422. (game-module (instructions (
  423.   "If you've played version 5, then just play this in the same way."
  424.   "If you've never played version 5, choose the `standard game' instead."
  425.   )))
  426.  
  427. (game-module (notes (
  428.   "(This attempts to be an accurate rendition of 5.x.)"
  429.   "(The old notes follow:)"
  430.   ""
  431.   "This game is the most commonly played Xconq game.  It"
  432.   "represents units of about 1945, from infantry to atomic bombs.  This is"
  433.   "familiar, which makes it easier to play, but also more controversial,"
  434.   "since historians have many conflicting theories about which kinds of"
  435.   "units were most effective."
  436.   ""
  437.   "Opinions differ about optimal strategy for this game.  In general,"
  438.   "blitzkrieg works, and can win the game in a hurry.  The problem is to"
  439.   "muster enough force before striking.  One full troop transport is not"
  440.   "enough; the invasion will melt away like ice cream on a hot sidewalk,"
  441.   "unless"
  442.   "reinforcements (either air or land) show up quickly.  Air cover is very"
  443.   "important.  While building up an invasion force, airborne assaults using"
  444.   "bombers and infantry can provide useful diversions, although it can be"
  445.   "wasteful of bombers.  Human vs human games on a 60x30 world generally"
  446.   "last about 100 turns, usually not enough time or units to build atomic"
  447.   "bombs or battleships, and not a big enough world to really need carriers"
  448.   "(although bases for staging are quite useful)."
  449.   )))
  450.  
  451. (add u* help
  452. ("marches around and captures things"
  453. "faster than infantry, limited to open terrain"
  454. "interceptor to get those nasty bombers"
  455. "long range aircraft, carries infantry and bombs"
  456. "fast, cheap, and sinks subs"
  457. "sneaks around and sinks ships"
  458. "carries infantry and armor across the pond"
  459. "carries fighters and bombers around"
  460. "the most powerful ship"
  461. "leveler of cities (and anything else)"
  462. "airbase plus port"
  463. "smaller than a city"
  464. "capital of a side"))
  465.  
  466. (add i notes (
  467.   "The infantry division is the slowest of units, but it can go almost"
  468.   "anywhere.  It is also quick to produce.  Infantry is the staple of"
  469.   "campaigns - a little boring perhaps, but essential to success."
  470.   ))
  471. (add a notes (
  472.   "The armor division is highly mobile and hits hard.  Unfortunately,"
  473.   "it is limited to operating in open terrain - plains and desert.  It also"
  474.   "takes longer to produce.  Armor can last twice as long in the  "
  475.   "desert as infantry.  Both armor and infantry can"
  476.   "assault and capture cities; they are the only units that can do so."
  477.   ))
  478. (add f notes (
  479.   "A fighter is a squadron or wing of high-speed armed aircraft."
  480.   "Their fuel supply can be gotten only at units, towns, and bases, so they"
  481.   "must continually be taking off and landing.  Fighters are not too effective"
  482.   "against ground units or ships, but they eat bombers for lunch.  Fighters"
  483.   "are very good for reconnaisance - important when you can't always"
  484.   "see the enemy moving!"
  485.   ))
  486. (add b notes (
  487.   "Bombers are very powerful, since they can seriously damage"
  488.   "or even flatten cities.  Loss rate in such activities is high, so they're"
  489.   "not a shortcut to victory!"
  490.   "Bombers can carry one infantry, which is very useful for raiding."
  491.   ))
  492. (add d notes (
  493.   "Destroyers are fast small ships for both exploration and"
  494.   "anti-submarine activities."
  495.   ))
  496. (add s notes (
  497.   "The favorite food of submarines is of course merchant shipping"
  498.   "and troopships, and they can sink troop transports with one blow."
  499.   "Subs are also invisible, but vulnerable to destroyers and aircraft."
  500.   ))
  501. (add t notes (
  502.   "This is how ground units get across the sea.  They can"
  503.   "defend themselves against ships and aircraft, but are basically vulnerable."
  504.   "They're not very fast either."
  505.   ))
  506. (add cv notes (
  507.   "Compensates for the fighter's limited range by providing"
  508.   "a portable airport.  Carriers themselves are sitting ducks, particularly"
  509.   "with respect to aircraft.  Fighter patrols are mandatory."
  510.   ))
  511. (add bb notes (
  512.   "The aptly named `Dread Naught' has little to fear from other"
  513.   "units of this period.  Subs may sink them with enough effort, and a group"
  514.   "of bombers and fighters are also deadly,"
  515.   "but with eight hit points to start,"
  516.   "a battleship can usually survive long enough to escape."
  517.   "Battleships are very"
  518.   "effective against cities and armies, at least the ones on the coast."
  519.   ))
  520. (add nk notes (
  521.   "Atomic bombs.  The Final Solution; but they are not easy to use.  A bomb"
  522.   "takes a long time to produce, moves very slowly by itself, and is easily"
  523.   "destroyed by other units. The plus side is instant destruction for any unit"
  524.   "of any size!  Bombs are imagined to be transported by a team of scientists,"
  525.   "and so can go on any sort of terrain without running out of supplies."
  526.   ))
  527. (add / notes (
  528.   "To simplify matters, this can serve as a camp, airbase, and port."
  529.   "Bases cannot build units, although they can repair some damage."
  530.   ))
  531. (add * notes (
  532.   "Towns are the staple of territory.  They can build, repair, produce"
  533.   "fuel and ammo, and serve as a safe haven for quite a few units."
  534.   ))
  535. (add @ notes (
  536.   "Cities are very large, powerful, and well defended.  They are"
  537.   "basically capital cities, or something in a comparable range.  (New York"
  538.   "and San Francisco are cities, Salt Lake City and San Antonio are towns."
  539.   "Yeah, San Antonio has a lot of people, but it's still insignificant,"
  540.   "nyah nyah.)  A city is worth five towns, territory-wise."
  541.   ))
  542.  
  543. (set synthesis-methods
  544.   '(make-fractal-percentile-terrain make-countries make-independent-units
  545.     make-initial-materials name-units-randomly))
  546.  
  547. (include "nat-names")
  548.  
  549. (add (* @) namer "random-town-names")
  550.  
  551. (include "town-names")
  552.  
  553.